home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 February
/
Ahoy_Magazine_86-02_1986_Double_L.d64
/
making change 2
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
370b
|
16 lines
0 rem << cd26-1b >>
100 rem problem #22-1 : making change
110 :
120 rem paul t. dawson
130 :
140 input "amount of money (cents)";x
150 input "number of coins";y
160 for q = int((x-y)/24) to 0 step -1
170 for d = 0 to 100
180 n = (x-y-(24*q)-(9*d))/4
190 p = y - (q+d+n)
200 if q>=0 and n>=0 and p>=0 and n=int(n) then print "q"q"d"d"n"n"p"p
210 if n > 0 then next d
220 next q : print "finished"
230 p = y - (q+d+n)